<template>
  <div class="my-counter">
    <button type="button" class="btn btn-light" @click="reduceFn">-</button>
    <input type="number" class="form-control inp" v-model.number.lazy="countNum.goods_count" @blur="changeFn">
    <button type="button" class="btn btn-light" @click="countNum.goods_count++" >+</button>
  </div>
</template>

<script>
export default {
 props:{
  countNum: {
   type:Object,
   required:true
  }
 },
 methods: {
  reduceFn() {
   if(this.countNum.goods_count <=  1) {
    this.countNum.goods_count = 1
   }
  },
  changeFn() {
   if(this.countNum.goods_count <= 0 ) {
   this. countNum.goods_count = 1
   }
  }
 }
}
</script>

<style lang="less" scoped>
.my-counter {
  display: flex;
  .inp {
    width: 45px;
    text-align: center;
    margin: 0 10px;
  }
  .btn, .inp{
    transform: scale(0.9);
  }
}
</style>